package com.qjq.glasses_shopping.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qjq.glasses_shopping.mapper.SeckillGoodsMapper;
import com.qjq.glasses_shopping.pojo.SeckillGoods;
import com.qjq.glasses_shopping.service.SeckillGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class SeckillGoodsServiceImpl implements SeckillGoodsService {
    @Autowired
    private SeckillGoodsMapper seckillGoodsMapper;

    @Override
    public void add(SeckillGoods seckillGoods) {
        seckillGoodsMapper.insert(seckillGoods);
    }

    @Override
    public void update(SeckillGoods seckillGoods) {
        seckillGoodsMapper.updateById(seckillGoods);
    }

    @Override
    public Page<SeckillGoods> findPage(int page, int size) {
        Page<SeckillGoods> page1 = seckillGoodsMapper.selectPage(new Page(page, size), null);
        return page1;
    }
}
